package com.victualler.business.inventory.service.impl;

import com.victualler.business.inventory.dto.GoodsModelInventoryDto;
import com.victualler.business.inventory.dto.GoodsModelInventoryScanDto;
import com.victualler.core.base.service.impl.BaseServiceImpl;
import com.victualler.business.inventory.entity.GoodsInventoryDao;
import com.victualler.business.inventory.repository.GoodsInventoryQueryRepository;
import com.victualler.business.inventory.repository.GoodsInventoryRepository;
import com.victualler.business.inventory.service.GoodsInventoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Guoshichang
 * @Date: Create in 17:03 2018/4/5
 * @Discription:  Dict字典类型对应的服务层
 */
@Service
public class GoodsInventoryServiceImpl extends BaseServiceImpl<GoodsInventoryDao,GoodsInventoryRepository,GoodsInventoryQueryRepository> implements GoodsInventoryService {
    /**
     * 获取商品型号对应的库存
     * @param goodsId 商品id
     * @return GoodsModelInventoryDto
     */
    public List<GoodsModelInventoryDto> getGoodsModelInventory(Long goodsId) {
        return this.baseQueryRepository.getGoodsModelInventory(goodsId);
    }

    /**
     * 获取商品型号对应的库存
     * @param barCode 条形码
     * @return GoodsModelInventoryDto
     */
    public GoodsModelInventoryScanDto getGoodsModelInventoryScan(String barCode) {
        return this.baseQueryRepository.getGoodsModelInventoryScan(barCode);
    }
}
